#pragma once

#include <core/types.h>


#ifndef __ASSEMBLY__
#define VA(x)  ((void *)(x))
#endif


static __INLINE__  BYTE ReadByte(unsigned long dwAddr)
{
	return *(volatile BYTE *)dwAddr;
}

static __INLINE__  void WriteByte(BYTE bVal, unsigned long dwAddr)
{
	*(volatile BYTE *)dwAddr = bVal;
}

static __INLINE__  unsigned short ReadShort(unsigned long dwAddr)
{
	return *(volatile unsigned short *)dwAddr;
}

static __INLINE__  void WriteShort(unsigned short hVal, unsigned long dwAddr)
{
	*(volatile unsigned short *)dwAddr = hVal;
}

static __INLINE__  unsigned long ReadLong(unsigned long dwAddr)
{
	return *(volatile unsigned long *)dwAddr;
}

static __INLINE__  void WriteLong(unsigned long lVal, unsigned long dwAddr)
{
	*(volatile unsigned long *)dwAddr = lVal;
}

//////////////////////

static __INLINE__  BYTE readb(void *pAddr)
{
	return *(volatile BYTE *)pAddr;
}

static __INLINE__  void writeb(BYTE bVal, void *pAddr)
{
	*(volatile BYTE *)pAddr = bVal;
}

static __INLINE__  unsigned short readw(void *pAddr)
{
	return *(volatile unsigned short *)pAddr;
}

static __INLINE__  void writew(unsigned short hVal, void *pAddr)
{
	*(volatile unsigned short *)pAddr = hVal;
}

static __INLINE__  unsigned long readl(void *pAddr)
{
	return *(volatile unsigned long *)pAddr;
}

static __INLINE__  void writel(unsigned long lVal, void *pAddr)
{
	*(volatile unsigned long *)pAddr = lVal;
}

